home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gwu / error.c < prev    next >
C/C++ Source or Header  |  1996-01-30  |  2KB  |  80 lines

  1. /*
  2.     GWAda Development Environment for 386/486 PCs   
  3.     Copyright (C) 1993, Arthur Vargas Lopes  & Michael Bliss Feldman
  4.                         vlopes@vortex.ufrgs.br mfeldman@seas.gwu.edu
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; version 2 of the License.    
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20. /* error.c */
  21.  
  22. #include "externs.h"
  23.  
  24.  
  25. void AVL_ERROR(char *s)
  26. {
  27.     AVL_WIN_PTR win;
  28.     short cor;
  29.     int ch, n1, n2;
  30.     struct rccoord old;
  31.     char msgs[3][77];
  32.     int i, j = 0, k = 0;
  33.     AVL_EDIT_WINDOW_PTR w;
  34.     w = &avl_windows[avl_window];
  35.     if (w -> line_no != 0)  {
  36.         for(i = 0; i < strlen(s); ++i) {
  37.             if (*(s+i) == '\n' ||  j > 75) {
  38.                 msgs[k][j++] = '\0';
  39.                 j = 0;
  40.                 k++;
  41.                 }
  42.             msgs[k][j++] = *(s+i);
  43.             }
  44.         msgs[k][j] = '\0';
  45.         }
  46.     else 
  47.         strcpy(msgs[k],s);
  48.     n1 = strlen(s) + 10;
  49.     if (n1 > 77) n1 = 80;
  50.     n2 = (80 - n1) / 2;
  51.     if (n2 <= 0) n2 = 1;
  52.     if ((n1 + n2) >= 80) n2 = 0;
  53.     win = AVL_MAKE_WINDOW(" Error Report ",7,n2,7+k+2,n1+n2,avl_wnd_bk_color,avl_wnd_color);
  54.     cor = _settextcolor(avl_err_color);
  55.     for(i = 0; i <= k; ++i)  {
  56.         _settextposition(2+i,2);
  57.         _outtext(msgs[i]);
  58.         }
  59.     AVL_PAUSE(20);
  60.     AVL_DEL_WINDOW(win);
  61. }
  62.  
  63. void AVL_PAUSE(short l)
  64. {
  65.     static char *cont = "Press any key to continue ...";
  66.     int ch, n1, n2;
  67.     AVL_WIN_PTR w;
  68.     n1 = strlen(cont);
  69.     n1 += 2;
  70.     n2 = (80 - n1) - 5;
  71.     w = AVL_MAKE_WINDOW("",l,n2,l+2,n1+n2+1,avl_wnd_bk_color,avl_wnd_color);
  72.     _setbkcolor(avl_msg_bk_color);
  73.     _settextcolor(avl_msg_color);
  74.     _settextposition(1,2);
  75.     _outtext(cont);
  76.     ch = getch();
  77.     if (ch == 0) ch = getch();
  78.     AVL_DEL_WINDOW(w);
  79. }
  80.